<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>继承</title>
	</head>
	<body>
		<script type="text/javascript">
			function Person(){
				this.name = "张三";
				this.chiness = "98";
				this.mathNum = "80";
			}
			Person.prototype.getname = function(){
				return this.name;
			}
			Person.prototype.getchiness = function(){
				return this.chiness;
			}
			Person.prototype.getmathNum = function(){
				return this.mathNum;
			}
			//创造另一个函数并继承上一个
			function Student(){
				this.age = "25";
			}
			Student.prototype = new Person();
			Student.prototype.getage = function(){
				return this.age;
			}
			var aa = new Student();
			alert("姓名：" + aa.getname() 
			+"\n" + "语文：" + aa.getchiness() 
			+"\n" + "数学：" + aa.getmathNum()
			+ "\n" + "年龄：" + aa.getage() )
			
			
			
		</script>
	</body>
</html>
